package de.wiv.tapestryportlet2.pages;

import java.util.Date;

import org.apache.tapestry5.Block;
import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.ioc.annotations.Inject;

public class About {

    @InjectComponent
    private Form  testForm;

    @Inject
    private Block sample;

    public void onValidateFormFromTestForm() {
        this.testForm.recordError("Hope it works!");
    }

    public void onSuccessFromTestForm() {
        System.out.println("success!");
    }

    public String getData() {
        return "bla";
    }

    public void setData(String data) {
        System.out.println("setData");
    }

    @OnEvent(value = EventConstants.ACTION, component = "showdown")
    public Object onShowdown() {
        return this.sample;
    }

    @OnEvent(value = EventConstants.ACTION, component = "showdownagain")
    public Object onShowdownagain() {
        return this.sample;
    }

    public Date getCurrentTime() {
        return new Date();
    }
}
